﻿using Dapper;
using System;
using BCEntity.OA.WorkflowTemplate.WorkflowTemplate;
using System.Collections.Generic;
using System.Data;
using System.Text;
using System.Threading.Tasks;

namespace BCData.OA.WorkflowTemplate.WorkflowTemplate
{
	/// <summary>
	/// 工作流模板
	/// </summary>
	public interface IWorkflowTemplateData
	{
		#region  成员方法
		/// <summary>
		/// 是否存在该记录
		/// </summary>
		/// <param name="workflowTemplateId">工作流模板Id</param>
		Task<bool> Exists(long workflowTemplateId);
		/// <summary>
		/// 增加工作流模板
		/// </summary>
		/// <param name="entity">工作流模板信息</param>
		Task<WorkflowTemplateEntity> Add(WorkflowTemplateEntity entity);
		/// <summary>
		/// 更新工作流模板
		/// </summary>
		/// <param name="entity">工作流模板信息</param>
		Task<WorkflowTemplateEntity> Update(WorkflowTemplateEntity entity);
		/// <summary>
		/// 删除工作流模板
		/// </summary>
		/// <param name="workflowTemplateId">工作流模板Id</param>
		Task<bool> Delete(long workflowTemplateId);
		/// <summary>
		/// 获取工作流模板
		/// </summary>
		/// <param name="workflowTemplateId">工作流模板Id</param>
		Task<WorkflowTemplateEntity> GetEntity(long workflowTemplateId);
		/// <summary>
		/// 获取工作流模板
		/// </summary>
		/// <param name="workflowTemplateCode">工作流模板Code</param>
		Task<WorkflowTemplateEntity> GetEntity(string workflowTemplateCode);
		/// <summary>
		/// 获取工作流模板
		/// </summary>
		/// <param name="specificTemplateKey">特殊工作流Key</param>
		/// <returns></returns>
		Task<WorkflowTemplateEntity> GetBySpecificKey(string specificTemplateKey);
		/// <summary>
		/// 获取工作流模板列表
		/// </summary>
		/// <param name="categoryCode">分类Code</param>
		Task<IEnumerable<WorkflowTemplateEntity>> GetList(string categoryCode);
		/// <summary>
		/// 获取工作流模板分页列表
		/// </summary>
		/// <param name="categoryCode">分类Code</param>
		/// <param name="templateName">模板名称</param>
		/// <param name="isBaseFlow">是否基本工作流</param>
		/// <param name="isMobleShow">是否移动端显示</param>
		/// <param name="start">开始时间</param>
		/// <param name="end">结束时间</param>
		/// <param name="sortName">排序字段</param>
		/// <param name="ascending">升序</param>
		/// <param name="pageIndex">当前页码</param>
		/// <param name="pageSize">每页数据条数</param>
		Task<(IEnumerable<WorkflowTemplateEntity>, int)> Query(string categoryCode, string templateName, bool? isBaseFlow, bool? isMobleShow, DateTime? start, DateTime? end, string sortName, bool? ascending, int pageIndex, int pageSize);
		#endregion  成员方法

		#region 获取允许我发起的工作流列表
		Task<IEnumerable<WorkflowTemplateEntity>> GetAllowInitiateList(int companyId, int? departmentId, long adminId, int positionId);
		#endregion
	}


}